package cn.com.newloading.ribbon.service;

import cn.com.newloading.common.service.BaseService;
import cn.com.newloading.common.utils.http.WebUtil;
import cn.com.newloading.common.utils.mq.MQConnectionUtil;
import cn.com.newloading.common.utils.mq.MQMsgUtil;
import cn.com.newloading.ribbon.util.MQSendUtil;
import com.alibaba.fastjson.JSONObject;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;

@Service
public class TestService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(TestService.class);
    @Autowired
    private WebUtil webUtil;

    public String test1(Map<String,String> params){
        String url = "http://localhost:8701/client/test";
        return (String) webUtil.doRequest(url,params);
    }

    public Map test2(Map<String,String> params){
        return (Map) webUtil.doRequest(EUREKA_CLIENT,"client/test",params,Map.class);
    }
    public Map test3(Map<String,String> params){
        return (Map) webUtil.doReq(EUREKA_CLIENT,"client/test",params,Map.class);
    }
    public void test4(String msg) throws IOException, TimeoutException {
        MQSendUtil.simpleQueueSend(msg);
    }
    public void test5(String msg) throws IOException, TimeoutException, InterruptedException {
        MQSendUtil.workQueueSend1(msg);
    }
}
